package com.dq.Week1.day04.arr;

import java.util.Scanner;

public class Demo06 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String[] names = new String[5];
        for (int i = 0; i < 5; i++) {
            System.out.println("请输入名字：");
            String name = scanner.next();

            int index = ArrUtils.indexStringArr(names, name);
            if (index == -1) {
                names[i] = name;
            } else {
                System.out.println("这个名字已经存在了");
                i--;
            }
            System.out.println(names[i]);
        }

    }
}
